@file:kotlin.jvm.JvmName("Asserts")

package com.gitee.wsl.mathematics.vector

import com.gitee.wsl.ext.number.approx
import com.gitee.wsl.mathematics.vector.vec2.Vec2f
import com.gitee.wsl.mathematics.vector.vec2.Vector2F
import com.gitee.wsl.mathematics.vector.vec3.Vec3f
import com.gitee.wsl.mathematics.vector.vec3.Vector3F
import com.gitee.wsl.mathematics.vector.vec4.Vec4f
import com.gitee.wsl.mathematics.vector.vec4.Vector4F
import kotlin.test.fail

fun assertEquals(expected: Float, actual: Float) {
    expected approx  actual || fail("expected <$expected> but was: <$actual>")
}

fun assertEquals(expectedX: Float, expectedY: Float, actual: Vector2F<*>) {
    expectedX approx actual.x || fail("X expected <$expectedX> but was: <${actual.x}>")
    expectedY approx actual.y || fail("Y expected <$expectedY> but was: <${actual.y}>")
}
fun assertEquals(expectedX: Float, expectedY: Float, expectedZ: Float, actual: Vector3F<*>) {
    expectedX approx actual.x || fail("X expected <$expectedX> but was: <${actual.x}>")
    expectedY approx actual.y || fail("Y expected <$expectedY> but was: <${actual.y}>")
    expectedZ approx actual.z || fail("Z expected <$expectedZ> but was: <${actual.z}>")
}

fun assertEquals(expectedX: Float, expectedY: Float, expectedZ: Float, expectedW: Float, actual: Vector4F<*>) {
    expectedX approx actual.x || fail("X expected <$expectedX> but was: <${actual.x}>")
    expectedY approx actual.y || fail("Y expected <$expectedY> but was: <${actual.y}>")
    expectedZ approx actual.z || fail("Z expected <$expectedZ> but was: <${actual.z}>")
    expectedW approx actual.w || fail("W expected <$expectedW> but was: <${actual.w}>")
}